//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_isledefmarkermove.sqf"
#include "x_setup.sqf"

private ["_grp", "_markern"];
_grp = _this;
sleep 30;
if (!isNull _grp && {(_grp call FUNC(GetAliveUnitsGrp)) > 0}) then {
	_markern = str(_grp) + "i_d_f_m" + str(GVAR(IsleDefMarkerMove));
	__INC(GVAR(IsleDefMarkerMove));
	[_markern, [0,0,0],"ICON","ColorRed",[0.5,0.5],(localize "STR_DOM_MISSIONSTRING_964"),0,GVAR(isle_defense_marker)] call FUNC(CreateMarkerGlobal);
	while {!isNull _grp && {(_grp call FUNC(GetAliveUnitsGrp)) > 0}} do {
		private "_lead";
		_lead = leader _grp;
		if (!isNull _lead) then {
			_markern setMarkerPos (getPosASL _lead);
		};
		sleep (10 + random 10);
	};
	deleteMarker _markern;
};